Close loaded baselines

I have a script that lists the baselines of a particular module along with another list of DXL attributes for that module's Current baseline.  Currently, when I open a new baseline, I'm not closing out the previous one and I'm not sure how to do this.  I've tried using

if (!null bl) {
    close bl;
}

where bl is a global variable of type Baseline.  But I am getting an error saying that I have "incorrect arguments for function (close)".  So what is the proper way to close a baseline?

 

Chris


chrscote - Fri Feb 16 12:21:09 EST 2018

Re: Close loaded baselines
Mike.Scharnow - Fri Feb 16 13:24:39 EST 2018

How do you "load" the baseline? If you used the perm "Module load (Baseline, bool)", you can close the returned module.

If you just use "for bl in module", then there's no need to close anything

 

Re: Close loaded baselines
chrscote - Mon Feb 19 08:02:31 EST 2018

I'm using load(baselineVersion) to open my baselines, then I put the baseline into a skipList so that I can wait until I have 5 open baselines before closing them.  This is a precaution I'm taking in case the user simply keeps clicking on individual baselines in succession so I can save a little processing.

 

Chris

Re: Close loaded baselines
Mike.Scharnow - Mon Feb 19 08:23:39 EST 2018

chrscote - Mon Feb 19 08:02:31 EST 2018

I'm using load(baselineVersion) to open my baselines, then I put the baseline into a skipList so that I can wait until I have 5 open baselines before closing them.  This is a precaution I'm taking in case the user simply keeps clicking on individual baselines in succession so I can save a little processing.

 

Chris

According to doors_perms.xls, that should indeed be the perm "Module load (Baseline, bool)" or "Module load (Module, Baseline, bool)", I cannot find any other perm with name "load" and parType "Baseline".

You can close the module that is created by the load perm.

So, your code should be something like

Module mCurrent = ...
Baseline bl
Skip sk = create()
for bl in mCurrent do {
    Module mBLForSkip = load (mCurrent, bl, false)
    put (sk, mBLForSkip, mBLForSkip)
}

Module mBL
for mBL in sk do {
    ... do something 
    close mBL
}

Alternatively, if you need the Baseline object itself, do something like

...
    put (sk, mBLForSkip, bl)
...

Baseline bl
for bl in sk do {
    ... do something with bl
        Module mToClose = (Module key sk)
        close mToClose
}

Hoping that this makes sense :)

Re: Close loaded baselines
chrscote - Mon Feb 19 08:44:09 EST 2018

Mike.Scharnow - Mon Feb 19 08:23:39 EST 2018

According to doors_perms.xls, that should indeed be the perm "Module load (Baseline, bool)" or "Module load (Module, Baseline, bool)", I cannot find any other perm with name "load" and parType "Baseline".

You can close the module that is created by the load perm.

So, your code should be something like

Module mCurrent = ...
Baseline bl
Skip sk = create()
for bl in mCurrent do {
    Module mBLForSkip = load (mCurrent, bl, false)
    put (sk, mBLForSkip, mBLForSkip)
}

Module mBL
for mBL in sk do {
    ... do something 
    close mBL
}

Alternatively, if you need the Baseline object itself, do something like

...
    put (sk, mBLForSkip, bl)
...

Baseline bl
for bl in sk do {
    ... do something with bl
        Module mToClose = (Module key sk)
        close mToClose
}

Hoping that this makes sense :)

Yes, this makes sense.  Thank you for your help.